#!/bin/bash
# filename pingall.sh
# 功能：按照/etc/hosts文件中的条目逐条ping所有的主机
# grab /etc/hosts and ping each address

cat /etc/hosts| grep -v '^#' | while read LINE
do
  ADDR=`awk '{print $1}'`
  for MACHINE in $ADDR
  do
    ping -s -c1 $MACHINE
  done
done
